'''
wordcloud
'''

from PIL import Image
from wordcloud import WordCloud
import matplotlib.pyplot as plt
import numpy as np

mask=np.array(Image.open("mask.png"))# 词云轮廓mask
filename="xx.txt" #词云所需文本
with open(filename) as f:
    mytext=f.read()

wordcloud=WordCloud(mask=mask,width=800*4, height=600*4, mode='RGBA', background_color=None).generate(mytext)
# 生成词云

plt.imshow(wordcloud,interpolation='bilinear')
plt.axis("off")
wordcloud.to_file('wordcloud1.png')
# plt.show()
